{include file="common/_header"}
{include file="common/_header1"}

<body class="layui-anim layui-anim-up">
<div class="x-nav">
    <!--    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:left;background: #00a0e9" href="javascript:location.replace('/products/shopsproduct');" title="返回">-->
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:left;background: #00a0e9" href="javascript:history.back(-1);" title="返回">
        <i class="layui-icon" style="line-height:30px">&#xe65c;</i></a>
    <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">用户管理</a>
            <a><cite>业务员列表</cite></a>
            <a><cite>{$data.title}</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>

</div>

<div class="x-body">

    <xblock>
        <span>用户名：{$data.userinfo.nick_name}</span><br>
        <span>用户身份：{if $data.userinfo.is_sales == 1}普通用户{else/}业务员{/if}</span>
    </xblock>

    <table id="tables" class="layui-table">
        <thead>
        <tr>
            <th>积分类型</th>
            <th>积分</th>
            <th>剩余积分</th>
            <th>明细信息</th>
            <th>时间</th>
        </tr>
        </thead>
        <tbody>
        {volist name="data.data" id="vo"}
        <tr class="table_tr">
            <td>{$data.types[$vo.type]}</td>
            <td>{$vo.value_show}</td>
            <td>{$vo.value}</td>
            <td>{$vo.note}</td>
            <td>{$vo.add_time|date='Y-m-d H:i'}</td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page_all">
        {$page|raw}
    </div>
</div>
<script>


    $(function () {
        // 表格选中行的同时选中单选框
        $("#tables tr:gt(0)").click(function () {
            $(this).find(":radio").prop("checked", true);
        });

    });

    //js放到table下，才能检测到tr数组
    var trs = document.getElementById("tables").getElementsByTagName("tr");
    $(function () {
        for (var i = 0; i < trs.length; i++) {
            trs[i].onmousedown = function () {
                mousedownclick(this);
            }
        }
    });

    function mousedownclick(obj) {
        for (var j = 0; j < trs.length; j++) {
            if (trs[j] == obj) {
                if (trs[0] != obj) {
                    trs[j].style.background = '#D0E9C6';
                    // 启用新增和编辑按钮
                    $("#edits").removeAttr("disabled");//启用按钮
                    $('#edits').removeClass('layui-disabled');
                }
            } else {
                trs[j].style.background = '';
            }
        }
    }


    function opreate(id) {
        layer.confirm('您确定要删除该商品吗?', {btn: ['确定', '取消'], title: "提示"}, function () {
            $.ajax({
                url: 'delproduct?productid=' + id,
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    layer.msg(data.msg, {
                        icon: 6,
                        time: 500,
                    }, function () {
                        window.location.reload();
                    })
                }
            })
        });
    }
</script>
</body>

{include file="common/_bottom"}